package com.study4j.crontab.task;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import com.study4j.common.model.ResultModel;
import com.study4j.crontab.rpc.IRabbitMQService;

import cn.hutool.core.date.DateTime;
import lombok.extern.slf4j.Slf4j;

/**
 * @description RabbitMQ初始化任务
 * @author Jiangbin
 * @date 2019年7月29日 上午10:13:58
 */
@Slf4j
public class RabbitMQInitTask implements Job {

	@Autowired
	private IRabbitMQService rabbitMQService;

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		log.info(String.format("[%s]开始执行RabbitMQ的初始化服务", DateTime.now()));
		ResultModel rabbitMQInitResult = rabbitMQService.rabbitMQInit();
		log.info(String.format("[%s]RabbitMQ的初始化服务执行结束，执行结果[%s]", DateTime.now(), rabbitMQInitResult));
	}
}
